//% color="#5c4033" iconWidth=50 iconHeight=40
namespace Unihiker_RGB2IMAGE{

    //% block="RGB颜色转图片，R[R], G[G], B[B],并保存为[FILENAME]" blockType="command"
    //% R.shadow="string" R.defl="255"
    //% G.shadow="string" G.defl="255"
    //% B.shadow="string" B.defl="255"
    //% FILENAME.shadow="string" FILENAME.defl="image.png"
    export function xunfei_init(parameter: any, block: any) {
        let r=parameter.R.code;
        let g=parameter.G.code;
        let b=parameter.B.code;
        let filename=parameter.FILENAME.code;
        Generator.addImport(`from RGB import RGBPICTURES`);
        Generator.addCode(`RGBPICTURES(${r}, ${g}, ${b}, ${filename})`);
    }

    //% block="RGB颜色转CMYK，R[R], G[G], B[B]" blockType="reporter"
    //% R.shadow="number" R.defl="255"
    //% G.shadow="number" G.defl="255"
    //% B.shadow="number" B.defl="255"
    export function rgb_to_cmyk(parameter: any, block: any) {
        let r=parameter.R.code;
        let g=parameter.G.code;
        let b=parameter.B.code;
        Generator.addImport(`from RGB import rgb_to_cmyk`);
        Generator.addCode(`rgb_to_cmyk(${r}, ${g}, ${b})`);
    }

}
